﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SplitOS.OSAL
{
	public static class Storage
	{
        public static List<string> appNames = new List<string>();
        public static List<string> applications = new List<string>();
        public static void AddApplication(string name, string code)
        {
            appNames.Add(name);
            applications.Add(code);
        }
        public static void RunApplication(string name)
        {
            string tmpCode;
            try { tmpCode = applications[IndexOf(appNames, name)]; Runner.Run(tmpCode); }
            catch { Console.WriteLine("The application \"" + name + "\" does not exist!"); }
        }
        private static int IndexOf(List<string> str, string str2)
        {
            for (int i = 0; i != str.Count; i++)
            {
                if (str[i] == str2) return i;
            }
            return -1;
        }
	}
}
